<?php

class Admin_Form_Create extends Zend_Form
{

    public function init()
    {
        $nom = new Zend_Form_Element_Text('nom');
        $nom->setLabel('nom')->setRequired(true)
                ->addValidator('NotEmpty')->setValue('')
                ->setErrorMessages(array('champ requise'))
                ->setAttribs(array('placeholder' => 'Nom' ,'required' => true, ''));

        $prenom = new Zend_Form_Element_Text('prenom');
        $prenom->setLabel('prenom')->setRequired(true)
                ->addValidator('NotEmpty')->setValue('')
                ->setErrorMessages(array('champ requise'))
                ->setAttribs(array('placeholder' => 'Prenom' ,'required' => true, ''));

        $email = new Zend_Form_Element_Text('email');
        $email->setLabel('Email')->setRequired(true)
                ->addValidator('EmailAddress')
                ->setErrorMessages(array('format adresse email'))
                ->setAttribs(array('placeholder' => 'Email Address' ,'required' => true, ''));

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel('Mot de passe')->setRequired(true)
                ->addValidator('StringLength', false, array(6, 20))
                ->setErrorMessages(array('min 6 caractères, max 20'))
                ->setAttribs(array('placeholder' => 'Password' ,'required' => true, ''));
        

        $submit = new Zend_Form_Element_Submit('submit');
        $submit ->setLabel('Valider')
                ->setAttrib('class', 'btn btn-large btn-primary');

        $this->addElements(array($nom, $prenom, $email, $password, $submit));
    }

    public function  __construct($form_create = null) {
        parent::__construct($form_create);

        $this->setMethod('Post');
        $this->setName('formCreate');
    }

}

